//
//  ViewController.m
//  28-animationLayout-Lagou
//
//  Created by 王道林 on 16/8/22.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageViewWelcome;
@property (weak, nonatomic) IBOutlet UIImageView *imageLagou;
@property (weak, nonatomic) IBOutlet UIButton *buttonD;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buttonD_W0;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buttonD_WD;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *lableWidth;
@property (weak, nonatomic) IBOutlet UILabel *lableWJ;

//代码铺图
@property (nonatomic, strong) UIButton *buttonZhu;
@property (nonatomic, strong) UIView *View1;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    _imageLagou.transform = CGAffineTransformMakeTranslation(0, -300);
    // button
    _buttonZhu = [UIButton buttonWithType:UIButtonTypeCustom];
    [_buttonZhu setTitle:@"现在注册拉钩" forState:UIControlStateNormal];
    _buttonZhu.titleLabel.textAlignment = 1;
    _buttonZhu.frame = CGRectMake(self.view.frame.size.width / 2, self.view.frame.size.height, 0, 0);
    [self.imageViewWelcome addSubview:_buttonZhu];
    // view
    _View1 = [[UIView alloc] initWithFrame:CGRectMake(0, 350, 0, 0)];
    _View1.backgroundColor = [UIColor grayColor];
    [_imageViewWelcome addSubview:_View1];
}

- (void)viewDidAppear:(BOOL)animated
{
    
    
    // 拉钩图片的动画
    [super viewDidAppear:animated];
    
    [UIView animateWithDuration:5 animations:^{
        _imageLagou.transform = CGAffineTransformIdentity;
       
    }];
    
    
    // 登陆的动画
    _buttonD_W0.priority = 750;
    _buttonD_WD.priority = 999;
//    [UIView animateWithDuration:5 animations:^{
//        [self.view layoutIfNeeded];
//    }];
    // lable忘记密码
    _lableWidth.constant = 150;
    [UIView animateWithDuration:5 delay:0 options: UIViewAnimationOptionOverrideInheritedCurve animations:^{
        [self.view layoutIfNeeded];
        _buttonZhu.frame = CGRectMake(100, 550, 214, 50);
        _View1.frame = CGRectMake(50, 300, 300, 100);
    } completion:^(BOOL finished) {
        
    }];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
